package com.gewu.bookeeping.MyDb.dao;

import android.content.Context;

import com.gewu.bookeeping.IModel.IMenyInDaoModel;
import com.gewu.bookeeping.MyDb.MyDatabase;
import com.gewu.bookeeping.MyDb.bean.ALiBeanOut;
import com.gewu.bookeeping.MyDb.bean.WeChtBeanOut;
import com.j256.ormlite.dao.Dao;

import java.sql.SQLException;
import java.util.List;

public class ALiDaoOutPerson implements IMenyInDaoModel {

    private Dao<ALiBeanOut,Integer> aLiBeanDao;

    public ALiDaoOutPerson(Context context) {
        try {
            this.aLiBeanDao = MyDatabase.getInstance(context).getDao(ALiBeanOut.class);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    @Override
    public int add(Object a) {
        int i=0;
        try {
            i = aLiBeanDao.create((ALiBeanOut) a);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return i;
    }

    @Override
    public int delect(int id) {
        return 0;
    }

    @Override
    public List<ALiBeanOut> quer() {
        List<ALiBeanOut> aLiBeanOuts=null;
        try {
            aLiBeanOuts = aLiBeanDao.queryForAll();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return aLiBeanOuts;
    }

    @Override
    public List<ALiBeanOut> querLike(String values) {
        List<ALiBeanOut> time=null;
        try {
            time = aLiBeanDao.queryForEq("time", values);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return time;
    }
}
